<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 准备好容器 -->
    <div id="test">
    </div>

</body>
<!-- 引入依赖 引入的时候，必须就按照这个步骤-->
<script src="../React-js/react.development.js" type = "text/javascript"></script>
<script src = "../React-js/react-dom.development.js" type = "text/javascript"></script>
<script src="../React-js/babel.min.js" type="text/javascript"></script>
<script src="../React-js/prop-types.js" type="text/javascript"></script>

<script type="text/babel">
    
    class Person extends React.Component{
        // 对标签属性进行类型，必要性限制
        static propTypes={
            name:PropTypes.string.isRequired,
            sex:PropTypes.string,
            age:PropTypes.number,
            speak:PropTypes.func
        }
        // 默认值
        static defaultProps= {
            sex:'男',
            age:18
        }
        render(){
            const{name,age,sex} = this.props
            return(
                <ul>
                    <li>姓名：{name}</li>    
                    <li>性别：{sex}</li>    
                    <li>年龄：{age+1}</li>    
                </ul>
            )
        }
    }
    

    ReactDOM.render(<Person name="tom"/>,document.getElementById("test"))
    
</script>
</html>